<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //输入下雨了就输出需要带伞，否则不带伞
        var rain = prompt("请输入天气情况");
        if ( rain.length == 3 ) {
            if ( rain === "下雨了") {
                alert("需要带伞");
            } else {
                alert("不需要带伞");
            }
        } else {
            alert("不需要带伞");
        }
        
    </script>
</body>
</html>